<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>背景属性</title>
    <style>
        .box1{
            width: 300px;
            height: 300px;
            background-color: yellow;
        }
        .box2{
            width: 300px;
            height: 300px;
            background-color: rgb(0, 255, 0);
        }
        .box3{
            width: 300px;
            height: 300px;
            background-color: rgba(255, 0, 0, 0.5);
        }
        .box4{
            width: 300px;
            height: 300px;
            background-color: #ff0000;
        }
        .box5{
            width: 100px;
            height: 100px;
            background-color: rgba(0, 0, 0, 0.5);
        }
        .box6{
            width: 300px;
            height: 300px;
            background-image: url(img/1.png);
        }
        .box7{
            width: 300px;
            height: 300px;
            background-image: url(img/2.jpg);
        }
        .box8{
            width: 300px;
            height: 300px;
            background-image: url(img/1.png);
            background-repeat: no-repeat;
            background-color: yellow;
        }
        .box9{
            width: 300px;
            height: 300px;
            background-image: url(img/1.png);
            background-repeat: repeat-x;
            background-color: yellow;
        }
        .box10{
            width: 300px;
            height: 300px;
            background-image: url(img/1.png);
            background-repeat: repeat-y;
            background-color: yellow;
        }
        .box11{
            width: 300px;
            height: 300px;
            background-image: url(img/1.png);
            background-repeat: no-repeat;
            /**
             1. 20px 20px;
             2. 10% 10%;
             3. left/center/right  top/center/bottom
            **/
            background-position: 20px 20px;
            background-color: yellow;
        }
    </style>
</head>
<body>
    <div class="box1">
        大家好
    </div>
    <hr>
    <div class="box2">
        大家好
    </div>
    <hr>
    <div class="box3">
        大家好
    </div>
    <hr>
    <div class="box4">
        大家好
        <div class="box5">
        </div>
    </div>
    <hr>
    <div class="box6">
        大家好
    </div>
    <hr>
    <div class="box7">
        大家好
    </div>
    <hr>
    <div class="box8">
        大家好
    </div>
    <hr>
    <div class="box9">
        大家好
    </div>
    <hr>
    <div class="box10">
        大家好
    </div>
    <hr>
    <div class="box11">
        大家好
    </div>
</body>
</html>